// Learn TypeScript:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html

export enum GameModel {
    GateModel,
    FuBenModel
}

const { ccclass, property } = cc._decorator;

@ccclass
export default class GameManager extends cc.Component {

    public gameModel: GameModel;

    private static _single: GameManager;
    public static get single(): GameManager {
        return GameManager._single;
    }

    protected onLoad(): void {
        if (GameManager._single == null) {
            GameManager._single = this;
        } else {
            this.node.destroy();
            this.node.removeFromParent();
        }

        cc.game.addPersistRootNode(this.node);


    }
}
